//----------------------------------------------------------------------------
//  ,-.
// /_\___ ,   Ninja Framework
// '  ___\    (C) Riccardo Capra - http://riccar.do
//  //   \\
//----------------------------------------------------------------------------
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
//----------------------------------------------------------------------------

#ifndef NJ_SHARED_SYNC_OBJECT_CONSANTS_H
#	define NJ_SHARED_SYNC_OBJECT_CONSANTS_H

#	include "NjExample01.h"
#	include "NjSynchronizationStats.h"

	/// \brief Implements few constants that depends from the synchronization object
	class NjSharedSyncObjectConstants
	{
	public:
		/// \brief Time granularity constant (in milliseconds)
		///
		/// Some multi-threaded tests have a time out multiple of this constant
		static NjEventsSystem::TimeMs const TIME_GRANULARITY = 200;

		/// \brief The type of synchronization object
		enum Type
		{
			/// \brief The synchronization object support recursion
			TYPE_RECURSIVE,

			/// \brief The synchronization object does not support recursion
			TYPE_NORMAL,

			/// \brief The synchronization object is semaphore-like
			TYPE_SEMAPHORE,

			/// \brief The synchronization object is dummy
			TYPE_DUMMY
		};

		/// \brief Constants depending from the synchronization object
		/// \param tSyncObject the involved synchronization object
		/// \param tSubSyncObject a type able to operate on tSyncObject and with the same interface of NjMutex (this parameter is relevant just for NjRWLock)
		template <typename tSyncObject, typename tSubSyncObject=tSyncObject>
		class Query
		{
		public:
			/// \brief The synchronization object name
			static NjChar const * const ms_szSyncObject;

			/// \brief The synchronization object type
			static Type const ms_eType;

			/// \brief Row used for statistic test on creation
			static NjSynchronizationStats::Row const ms_eCreationRow;

			/// \brief Row used for statistic test on lock/unlock
			static NjSynchronizationStats::Row const ms_eLockRow;

			NJ_DISABLE_INSTANCE(Query);
		};

		NJ_DISABLE_INSTANCE(NjSharedSyncObjectConstants);
	};

#endif // NJ_SHARED_SYNC_OBJECT_CONSANTS_H
